![]() |
TrackControl |
||||
Header: | Controls.h | Carbon status: | Supported | |
Responds to cursor movements in a control while the mouse button is down.
ControlPartCode TrackControl ( ControlRef theControl, Point startPoint, ControlActionUPP actionProc );
A handle to the control in which a mouse-down event occurred.
A point, specified in coordinates local to the window, where the mouse-down event occurred.
A pointer to an action function defining what action your application takes while the user holds down the mouse button. The value of the actionProc parameter can be a valid procPtr, NULL, or -1. A value of -1 indicates that the control should either perform auto tracking, or if it is incapable of doing so, do nothing (like NULL). See ControlActionProcPtr for information about an action function to specify in this parameter.
If the user releases the mouse button while the cursor is inside a control part, TrackControl returns a value of type ControlPartCode identifying the control part in which the mouse-up event occurs; see
When the Appearance Manager is available, you should typically call HandleControlClick instead of TrackControl to follow the user’s cursor movements in a control and provide visual feedback until the user releases the mouse button. Unlike the TrackControl function, HandleControlClick also accepts modifier key information so that the control may take into account the current modifier key state if the control is set up to handle its own tracking.
If the Appearance Manager is not available, you can use the TrackControl function to follow the user’s cursor movements in a control and provide visual feedback until the user releases the mouse button. The visual feedback given by TrackControl depends on the control part in which the mouse-down event occurs. When highlighting is appropriate, for example, TrackControl highlights the control part (and removes the highlighting when the user releases the mouse button). When the user holds down the mouse button while the cursor is in an indicator (such as the scroll box of a scroll bar) and moves the mouse, TrackControl responds by dragging a dotted outline of the indicator.
While the user holds down the mouse button with the cursor in one of the standard controls, TrackControl performs the following actions, depending on the value you pass in the parameter actionProc. (For other controls, what you pass in this parameter depends on how you define the control.)
Note that when you need to handle events in alert and dialog boxes, Dialog Manager functions automatically call FindControl and TrackControl.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)